<#-- @ftlvariable name="entity" type="com.xci.edu.core.entity.EduCategory" -->
<#include "/sys/_layout.ftl">
<#assign allowInsert=sysWeb.auth("background.eduCategory.insert")/>
<#assign allowUpdate=sysWeb.auth("background.eduCategory.update")/>
<#assign allowDelete=sysWeb.auth("background.eduCategory.delete")/>
<#assign allowExport=sysWeb.auth("background.eduCategory.export")/>
<!doctype html>
<html>
<head>
    <@pageHeader/>
</head>
<body>
<@pageLoading/>
<div id="gridtoolbar">
    <form id="gridform" class="jxlayout-form form-inline jxform">
        <div class="form-group">
            <input name="name" class="form-control w-250px" placeholder="请输入科目名称" autocomplete="off">
        </div>
        <button class="btn btn-primary ml-5" type="submit">
            <i class="fa fa-search"></i> 查询
        </button>
        <div class="btn-group">
            <@echo test=allowInsert>
            <a class="btn btn-default" onclick="curd.createData()">
                <i class="icon-plus"></i> 新建
            </a>
        </@echo>
        <@echo test=allowUpdate>
            <a class="btn btn-default" onclick="curd.editData()">
                <i class="icon-pencil"></i> 编辑
            </a>
        </@echo>
        <@echo test=allowDelete>
            <a class="btn btn-default" onclick="curd.deleteData()">
                <i class="icon-trash"></i> 删除
            </a>
        </@echo>
        <@echo test=allowExport>
            <a class="btn btn-default" onclick="curd.exportData()">
                <i class="icon-share-alt"></i> 导出
            </a>
        </@echo>
        </div>
    </form>
</div>
<table id="grid" data-options="form:'#gridform',toolbar:'#gridtoolbar'">
    <thead>
    <tr>
        <th data-options="field:'ck',checkbox:true"></th>
        <th data-options="title:'科目名称',field:'name',width:100,align:'left',sortable: false"></th>
        <th data-options="title:'培训总学时(秒)',field:'totalPeriod',width:100,align:'left',sortable: false"></th>
        <th data-options="title:'每日最大培训学时(秒)',field:'dayMaxPeriod',width:150,align:'left',sortable: false"></th>
        <th data-options="title:'验证问题允许尝试最大次数',field:'validateTryTime',width:180,align:'left',sortable: false"></th>
        <th data-options="title:'验证问题回答超时时间(秒)',field:'validateTimeout',width:180,align:'left',sortable: false"></th>
        <th data-options="title:'验证问题随机弹出时间范围',field:'validateRandomRange',width:180,align:'left',sortable: false"></th>
        <th data-options="title:'状态',field:'status',width:200,align:'left',sortable: false,formatter:jx.gf.status"></th>
        <!--<th data-options="title:'备注',field:'remark',width:200,align:'left',sortable: false"></th>-->
    </tr>
    </thead>
</table>
<@pageFooter/>
<script>
    jx.ready(function () {
        window.curd = new jx.GridCurd('#grid', {
            title: '培训科目信息',
            dialogWidth: '600px',
            dialogHeight: '500px',
            api: {
                grid: '/background/eduCategory/grid',
                create: '/background/eduCategory/create',
                edit: '/background/eduCategory/edit',
                delete: '/background/eduCategory/delete',
                details: '/background/eduCategory/details',
                status: '/background/eduCategory/status',
                export: '/background/eduCategory/export'
            },
            onInit: function (instance) {
                //状态事件
                instance.gridPanel.on('click', '.gridstatus', function () {
                    instance.setStatusDataById($(this).data('id'), $(this).data('val') == '1' ? 0 : 1);
                });
            }
        });
    });
</script>
</body>
</html>